#ifndef UTILS_H
#define UTILS_H

#include <qobject.h>
#include <qstring.h>

#define ESCAPE "\\"
#define DOUBLE_ESCAPE ESCAPE ESCAPE

class Utils: public QObject
{
    Q_OBJECT

public:
    static QString escape(QString str, QString separator, QString delim);
    static QString unescape(QString str, QString separator, QString delim);
    static int findSeparator(QString str, QString sep, QString escape, int from);
    static QStringList mySplit(QString str, QString sep, QString escape);

    static QString StringMD5(QString str);
    static QString FileMD5(QString fname);

    static bool saveData(const QByteArray &data, QString fname);

    static QString jPair(QString key, QString value);
    static QString jPair(QString key, qint32 value);
    static QString jPair(QString key, qreal value);
    static QString jPair(QString key, qulonglong value);

};


#endif
